package com.wt.servlet;


import com.alibaba.fastjson.JSONObject;
import com.wt.controller.LoginController;
import com.wt.controller.WqunCommunityBanController;
import com.wt.entity.WqunAccount;
import com.wt.entity.utilEntity.login.LoginAccount;
import com.wt.util.R.R;
import com.wt.util.ResultMess.ResultMess;
import com.wt.util.axios.Axios;
import com.wt.util.axios.JsonToEntity;
import com.wt.util.axios.Return;
import com.wt.util.exceptionhandler.WQUNException;
import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;

@WebServlet({"/admin/wqunCommunityBan/deleteBan","/admin/wqunCommunityBan/addBan"})
public class CommunityBanServlet extends HttpServlet {
    WqunCommunityBanController wqunCommunityBanController  = new WqunCommunityBanController();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        JSONObject jsonObject = null;
        HashMap<String, String> map = null;

        //System.out.println(req.getRequestURL().substring(req.getRequestURL().lastIndexOf("/")+1));
        switch (req.getRequestURL().substring(req.getRequestURL().lastIndexOf("/")+1)){
            case "addBan":
                String id = req.getParameter( "id");
                Return.R(resp,wqunCommunityBanController.addBan(id));
                break;
            case "deleteBan":
                String id2 = req.getParameter( "id");
                Return.R(resp,wqunCommunityBanController.deleteBan(id2));
                break;


        }
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
